package com.hbyj.object;

import java.util.ArrayList;
import java.util.List;

public class FlexiGridData<T> {
	private Integer total;
	private Integer page;
	private List<FlexiGridRow<T>> rows;
	
	public FlexiGridData(Integer total,Integer page,List hiberObjs,List<IFlexiGridable> gridDatas){
		setTotal(total);
		setPage(page);
		List<FlexiGridRow<T>> rows =this.PackDepartments(hiberObjs,gridDatas);
	    setRows(rows);
	}
	
	private List<FlexiGridRow<T>> PackDepartments(List hiberObjs,List<IFlexiGridable> gridDatas)
	{
		if(hiberObjs==null)
			return null;
		List<FlexiGridRow<T>> rlts = new ArrayList<FlexiGridRow<T>>();
		for (int i = 0; i < hiberObjs.size(); i++) {
			FlexiGridRow<T> row = new FlexiGridRow<T>(hiberObjs.get(i),gridDatas.get(i));
			rlts.add(row);
		}
		return rlts;
	}
	
	public void setTotal(Integer total) {
		this.total = total;
	}
	public Integer getTotal() {
		return total;
	}
	public void setPage(Integer page) {
		this.page = page;
	}
	public Integer getPage() {
		return page;
	}
	public void setRows(List<FlexiGridRow<T>> rows) {
		this.rows = rows;
	}
	public List<FlexiGridRow<T>> getRows() {
		return rows;
	}
}
